from django.http import Http404


def perform(request, action_name):
	from gaev.actions import get_action 
	from gaev.actions.url import get_object_from_specification 
	from gaev import exceptions
	from data import models
	try:
		object=get_object_from_specification(request.GET)
		action=get_action(object, action_name)
	except exceptions.MissingActionError:
		raise Http404('Invalid action name: %s' % action_name)
	except exceptions.MissingModelError:
		raise Http404('Invalid model name: %s' % model_name)

	action.assign_request(request)	
	return action.perform()
	
		
